import axios from './http'
// 请求轮播图
// bus_id: 商户id
export const getBannerList = (bus_id?: string | undefined) => {
    return axios.get<ResponseDataType<BannerRowType[]>>('/bannerList', { params: { bus_id } })
}
// 请求医生列表
export const getDoctorList = (params: { bus_id?: string | undefined, page?: number, size?: number }) => {
    return axios.get<ResponseDataType<DoctorRowType[]>>('/doctorList', { params })
}
// 请求医生详情
export const getDoctorDetail = (id: string | undefined) => {
    return axios.get<ResponseDataType<DoctorRowType>>('/doctorDetail', { params: { id } })
}

// 请求商户信息
export const getBusinessInfo = (id: string | undefined) => {
    return axios.get<ResponseDataType<BusinessRowType>>('/businessInfo', { params: { id } })
}

// 请求短信验证码
export const getMsgCode = (phone: string | number) => {
    return axios.get<ResponseDataType<string>>('/getMsgCode', { params: { phone } })
}

// 登录注册
export const login = (data: { phone: string, msgCode: string }) => {
    return axios.post<ResponseDataType<any>>('/login', data)

}
// 请求预约列表数据
export const getAppointList = (params: { patientid?: number, doctorid?: number }) => {
    return axios.get<ResponseDataType<AppointRowType[]>>('/appointmentList', { params })
}
// 更新预约数据
export const appointmentUpdate = (data: { id: number, status?: number, appoint_time?: string | number }) => {
    return axios.post<ResponseDataType>('/appointmentUpdate', data)
}

// 发布预约
export const appointmentAdd = (data: { patientid: number, doctorid: number, name: string, phone: string, appoint_time: number }) => {
    return axios.put<ResponseDataType>('/appointmentAdd', data)

}
// 更新个人信息
export const doctorUpdate = (data: FormData) => {
    return axios.post<ResponseDataType>('/doctorUpdate', data)
}